package com.itheima.behaviour.controller;
import com.itheima.behaviour.dto.LikesBehaviourDto;
import com.itheima.behaviour.pojo.ApLikesBehavior;
import com.itheima.behaviour.service.ApLikesBehaviorService;
import com.itheima.common.pojo.Result;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;
import com.itheima.core.controller.AbstractCoreController;

/**
* <p>
* APP点赞行为表 控制器</p>
* @author 作者
* @since 2021-08-30
*/
@RestController
@RequestMapping("/apLikesBehavior")
public class ApLikesBehaviorController extends AbstractCoreController<ApLikesBehavior> {

    private ApLikesBehaviorService apLikesBehaviorService;

    //注入
    @Autowired
    public ApLikesBehaviorController(ApLikesBehaviorService apLikesBehaviorService) {
        super(apLikesBehaviorService);
        this.apLikesBehaviorService=apLikesBehaviorService;
    }

    /***
     * 点赞/取消点赞行为记录
     */
    @PostMapping(value = "/lik")
    public Result like(@RequestBody LikesBehaviourDto dto){
        //点赞/取消点赞行为记录
        apLikesBehaviorService.like(dto);
        return Result.ok();
    }

}

